<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="../lib/OSL/layui/css/layui.css">
    <link rel="stylesheet" href="../lib/fonts/icomoon/style.css">
    <link rel="stylesheet" href="../lib/css/page/users_manage.css">
</head>

<body>
    <!-- 卡片区域 -->
    <div class="layui-card">
        <div class="layui-card-header">
            <span>床位维修管理</span>
            <!-- <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="addUsers">添加学生</button> -->
        </div>

        <div class="layui-card-body">
            <!-- //搜索区 -->
            <form class="layui-form" id="form_search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">学号</label>
                    <div class="layui-input-block">
                        <input type="text" name="sno" placeholder="请输入学号" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <div style="margin-left: 10px;">
                        <button class="layui-btn btn_search" lay-submit lay-filter="formDemo">搜索</button>
                    </div>
                </div>
            </form>
            <!-- //数据区 -->
            <table class="layui-table">
                <colgroup>
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <!-- <col /> -->
                </colgroup>
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>学号</th>
                        <th>学院</th>
                        <th>班级</th>
                        <th>手机号码</th>
                        <th>是否入住</th>
                        <th>楼栋名称</th>
                        <th>宿舍名称</th>
                        <th>入住时间</th>
                        <td>维修状态</td>
                        <!-- <th>寝室图片</th> -->
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
            <!-- //分页区域 -->
            <div id="pageBox"></div>
        </div>
    </div>

    <script src="../lib/OSL/jquery.js"></script>
    <script type="text/javascript" src="../lib/OSL/layui/layui.all.js"></script>
    <script src="../lib/js/baseAPI.js"></script>
    <script src="../lib/js/page/live.js"></script>
    <script src="../lib/OSL/template-web.js"></script>

    <!-- 获取所有用户数据的表格模板 -->
    <script type="text/html" id="tpl-table">
        {{each data}}
        <tr>
            {{if $value.access !==1}}
            {{if $value.flag == 1}}
            <td>{{$value.username}}</td>
            <td>{{$value.sno}}</td>
            <td>{{$value.college}}</td>
            <td>{{$value.aclass}}</td>
            <td>{{$value.phone_number}}</td>
            {{if $value.flag ==0}}
            <td><button type="button" class="layui-btn layui-btn-xs" disabled="true"
                    style="cursor:default;background-color: #ff006e">未入住</button>
            </td>
            {{else}}
            <td><button type="button" class="layui-btn layui-btn-warm layui-btn-xs" disabled="true"
                    style="cursor:default">已入住</button>
            </td>
            {{/if}}

            <!-- ---------------------------------------------------------------- -->
            <td>{{$value.floor}}</td>
            <td>{{$value.hostel}}</td>
            <td>{{$value.start_time}}</td>
            {{if $value.fix_flag ==1}}
            <td><button type="button" class="layui-btn layui-btn-xs" disabled="true"
                    style="cursor:default;background-color: #ff006e">维修中</button>
            </td>
            {{else}}
            <td><button type="button" class="layui-btn layui-btn-primary layui-btn-xs" disabled="true"
                    style="cursor:default">无</button>
            </td>
            {{/if}}
            <!-- <td>
                    <button type="button" class="layui-btn layui-btn-sm btn_viewDevice" data_id="{{$value.id}}"
                        style="background-color: #EF476F">查看图片
                    </button>
                </td> -->


            <!-- ---------------------------------------------------------------- -->
            <td>
                {{if $value.fix_flag ==0}}
                <button type="button" class="layui-btn layui-btn-danger layui-btn-sm btn_fixUser"
                    data_id="{{$value.id}}">维修</button>
                {{else}}
                <button type="button" class="layui-btn layui-btn-disabled layui-btn-sm">维修</button>
                {{/if}}
                {{if $value.fix_flag ==1}}
                <button type="button" class="layui-btn layui-btn-danger layui-btn-sm btn_reFix"
                    data_id="{{$value.id}}">恢复</button>
                {{else}}
                <button type="button" class="layui-btn layui-btn-disabled layui-btn-sm">恢复</button>
                {{/if}}
            </td>
            {{/if}}
            {{/if}}
        </tr>
        {{/each}}
    </script>
    <!-- ---------------------------------------------------------------- -->
    <!-- 修改用户信息的表格数据模板 -->
    <script type="text/html" id="dialog_editUsers">
        <form class="layui-form" id="form_editUser" lay-filter="form_edit">
            <input type="hidden" name="id">

            <div class="layui-form-item">
                <label class="layui-form-label">楼栋名称</label>
                <div class="layui-input-block">
                    <select name="lab_address" lay-verify="required">
                        <option value=""></option>
                        {{each}}
                        <option value="{{$value.cate_name}}">{{$value.cate_name}}</option>
                        {{/each}}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">宿舍名称</label>
                <div class="layui-input-block">
                    <select name="hostel" lay-verify="required">
                        <option value=""></option>
                        {{each}}
                        <option value="{{$value.lab_class_name}}">{{$value.lab_class_name}}</option>
                        {{/each}}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认</button>
                </div>
            </div>
        </form>
    </script>
</body>

</html>